from apps.clsbb.models import *
from extensions.serializers import *


class Clsbbfak_RecordsSerializer(BaseSerializer):
    company_name = CharField(source='company.name',  read_only=True, label='公司')
    classification_name = CharField(source='classification.name',  read_only=True, label='分类')
    industry_name = CharField(source='industry.name',  read_only=True, label='行业')
    filled_by_name = CharField(source='filled_by.name',  read_only=True, label='填报人')
    next_checker_name = CharField(source='next_checker.name',  read_only=True, label='下一步审核人')

    class Clsbbfak_Common_PdfsSerializer(BaseSerializer):
        class Meta:
            model = Clsbb_Common_Pdfs
            fields = ['id', 'file','name','type']

    clsbbfak_pdf_item = Clsbbfak_Common_PdfsSerializer(source='attachments_scheme', read_only=True, label='方案库附件')
    class ClsbbfakChecksSerializer(BaseSerializer):
        check_user_name = CharField(source='check_user.name', read_only=True, label='审核人')
        class Meta:
            model = ClsbbfakCheck
            fields = ['id', 'clsbbfak','check_user','check_user_name','opinion','is_agree','add_time']

    clsbbfak_checks_items = ClsbbfakChecksSerializer(
        source='check_records', many=True, read_only=True, label='审核记录')

    class Downloads_logSerializer(BaseSerializer):
        download_by_name = CharField(source='download_by.name', read_only=True, label='下载人')
        download_by_company = CharField(source='download_by.company.name', read_only=True, label='下载所属公司')
        class Meta:
            model = Downloads_log
            fields = "__all__"


    class Views_logSerializer(BaseSerializer):
        view_by_name = CharField(source='view_by.name', read_only=True, label='查看人')
        view_by_company = CharField(source='view_by.company.name', read_only=True, label='查看人所属公司')
        class Meta:
            model = Views_log
            fields = "__all__"

    downloads_logs = Downloads_logSerializer(source='downloads_log', read_only=True,many=True,label='下载记录')
    views_logs = Views_logSerializer(source='views_log', read_only=True, many=True, label='查看记录')

    class Meta:
        model = Clsbbfak_Records
        # read_only_fields = ['id','clsbbfak_pdf_item','clsbbfak_checks_items','downloads_logs_items','views_logs_items','downloads', 'views']
        read_only_fields = ['id', 'company_name',
                  'classification_name',
                  'industry_name','clsbbfak_pdf_item','clsbbfak_checks_items','downloads', 'views','downloads_logs','views_logs']
        fields = ['company',
                  'number','keywords','name',
                  'describe',
                  'contact_scheme',
                  'contact_phone_scheme',
                  'name_partne',
                  'contact_partne',
                  'contact_phone_partne',
                  'maintainer_scheme',
                  'maintainer_phone_scheme',
                  'remarks',
                  'classification',
                  'industry',
                  'attachments_scheme',
                  'filled_by',
                  'filled_by_name',
                  'step','next_checker',
                  'next_checker_name',
                  'is_effective','add_time',
                  *read_only_fields]


    def create(self, validated_data):
        return super().create(validated_data)

    def update(self, instance, validated_data):
        return super().update(instance, validated_data)


class Clsbbfak_RecordsImportSerializer(BaseSerializer):
    company = CharField(required=False,label='归属单位')
    name = CharField(required=False,label='方案名称')
    describe = CharField(required=False,label='方案描述')
    keywords = CharField(required=False,label='方案关键词')
    classification = CharField(required=False,label='方案分类')
    industry = CharField(required=False,label='方案行业')
    contact_scheme = CharField(required=False,label='方案联系人')
    contact_phone_scheme = CharField(required=False,label='方案联系人电话')
    name_partne = CharField(required=False,label='合作方名称')
    contact_partne = CharField(required=False,label='合作方联系人')
    contact_scheme = CharField(required=False,label='方案联系人')
    contact_phone_partne = DateTimeField(required=False, label='合作方联系人电话')
    maintainer_scheme = CharField(required=False,label='方案维护人')
    maintainer_phone_scheme = CharField(required=False,label='方案维护人联系电话')
    remark = CharField(required=False, label='备注')

    class Meta:
        model = Clsbbfak_Records
        fields = ['company','name','describe','keywords','classification','industry','contact_scheme',
                  'contact_phone_scheme','name_partne','contact_partne',
                  'contact_phone_partne','maintainer_scheme','maintainer_phone_scheme','remark']


class Clsbbalk_RecordsSerializer(BaseSerializer):
    company_name = CharField(source='company.name',  read_only=True, label='公司')
    product_name = CharField(source='product.name',  read_only=True, label='产品')
    industry_name = CharField(source='industry.name',  read_only=True, label='行业')
    filled_by_name = CharField(source='filled_by.name',  read_only=True, label='填报人')
    next_checker_name = CharField(source='next_checker.name',  read_only=True, label='下一步审核人')

    class Clsbb_Common_PdfsSerializer(BaseSerializer):
        class Meta:
            model = Clsbb_Common_Pdfs
            fields = ['id', 'file','name','type']

    attachments_case_item = Clsbb_Common_PdfsSerializer(source='attachments_case', read_only=True, label='案例文档附件')
    acceptance_report_item = Clsbb_Common_PdfsSerializer(source='acceptance_report', read_only=True, label='案例文档附件')
    case_contract_item = Clsbb_Common_PdfsSerializer(source='case_contract', read_only=True, label='案例文档附件')
    notification_announcement_item = Clsbb_Common_PdfsSerializer(source='notification_announcement', read_only=True, label='案例文档附件')
    bidding_documents_item = Clsbb_Common_PdfsSerializer(source='bidding_documents', read_only=True, label='案例文档附件')
    class ClsbbalkChecksSerializer(BaseSerializer):
        check_user_name = CharField(source='check_user.name', read_only=True, label='审核人')
        class Meta:
            model = ClsbbalkCheck
            fields = ['id', 'clsbbalk','check_user','check_user_name','opinion','is_agree','add_time']

    clsbb_checks_items = ClsbbalkChecksSerializer(
        source='check_records', many=True, read_only=True, label='审核记录')


    class Downloads_logSerializer(BaseSerializer):
        download_by_name = CharField(source='download_by.name', read_only=True, label='下载人')
        download_by_company = CharField(source='download_by.company.name', read_only=True, label='下载所属公司')
        class Meta:
            model = Alk_Downloads_log
            fields = "__all__"


    class Views_logSerializer(BaseSerializer):
        view_by_name = CharField(source='view_by.name', read_only=True, label='查看人')
        view_by_company = CharField(source='view_by.company.name', read_only=True, label='查看人所属公司')
        class Meta:
            model = Alk_Views_log
            fields = "__all__"

    downloads_logs = Downloads_logSerializer(source='downloads_log', read_only=True,many=True,label='下载记录')
    views_logs = Views_logSerializer(source='views_log', read_only=True, many=True, label='查看记录')

    class Meta:
        model = Clsbbalk_Records
        # read_only_fields = ['id','clsbbfak_pdf_item','clsbbfak_checks_items','downloads_logs_items','views_logs_items','downloads', 'views']
        read_only_fields = ['id', 'company_name',
                  'product_name',
                  'industry_name',
                  'attachments_case_item',
                  'acceptance_report_item',
                  'case_contract_item',
                  'notification_announcement_item',
                  'bidding_documents_item',

                'clsbb_checks_items','downloads',
                            'views','downloads_logs','views_logs']
        fields = ['company',
                  'number','keywords','name',
                  'describe',
                  'contact',
                  'contact_phone',
                  'name_partne',
                  'contact_partne',
                  'contact_phone_partne',
                  'maintainer',
                  'maintainer_phone',
                  'remarks',
                  'customer_name',
                  'industry',
                  'product',
                  'project_scale',
                  'bidding_or_not',
                  'signatory',
                  'bid_winning_amount',
                  'attachments_case',
                  'acceptance_report',
                  'case_contract',
                  'notification_announcement',
                  'bidding_documents',
                  'filled_by',
                  'filled_by_name',
                  'step','next_checker',
                  'next_checker_name',
                  'is_effective','add_time',
                  *read_only_fields]


    def create(self, validated_data):
        return super().create(validated_data)

    def update(self, instance, validated_data):
        return super().update(instance, validated_data)


class Clsbbalk_RecordsImportSerializer(BaseSerializer):
    company = CharField(required=False,label='归属单位')
    name = CharField(required=False,label='案例名称')
    describe = CharField(required=False,label='案例描述')
    keywords = CharField(required=False,label='案例关键词')
    customer_name = CharField(required=False,label='客户名称')
    industry = CharField(required=False,label='案例行业')
    product = CharField(required=False,label='案例产品')
    project_scale = CharField(required=False,label='项目规模')
    bidding_or_not = CharField(required=False,label='是否中标')
    signatory = CharField(required=False,label='签约主体')
    bid_winning_amount = FloatField(required=False,label='中标金额')
    contact = CharField(required=False,label='案例联系人')
    contact_phone = CharField(required=False,label='案例联系人电话')
    name_partne = CharField(required=False,label='合作方名称')
    contact_partne = CharField(required=False,label='合作方联系人')
    contact_scheme = CharField(required=False,label='方案联系人')
    contact_phone_partne = DateTimeField(required=False, label='合作方联系人电话')
    maintainer = CharField(required=False,label='案例维护人')
    maintainer_phone = CharField(required=False,label='案例维护人联系电话')
    remark = CharField(required=False, label='备注')

    class Meta:
        model = Clsbbalk_Records
        fields = ['company','name','describe','keywords','customer_name','industry','product',
                  'project_scale','bidding_or_not','signatory','bid_winning_amount','contact',
                  'contact_phone','name_partne','contact_partne',
                  'contact_scheme','contact_phone_partne','maintainer','maintainer_phone','remark']



class Clsbbtbk_RecordsSerializer(BaseSerializer):
    company_name = CharField(source='company.name',  read_only=True, label='公司')
    product_name = CharField(source='product.name',  read_only=True, label='产品')
    industry_name = CharField(source='industry.name',  read_only=True, label='行业')
    template_type_name = CharField(source='template_type.name',  read_only=True, label='行业')
    filled_by_name = CharField(source='filled_by.name',  read_only=True, label='填报人')
    next_checker_name = CharField(source='next_checker.name',  read_only=True, label='下一步审核人')

    class Clsbb_Common_PdfsSerializer(BaseSerializer):
        class Meta:
            model = Clsbb_Common_Pdfs
            fields = ['id', 'file','name','type']

    attachments_data_item = Clsbb_Common_PdfsSerializer(source='attachments_data', read_only=True, label='资料附件')
    class ClsbbtbkChecksSerializer(BaseSerializer):
        check_user_name = CharField(source='check_user.name', read_only=True, label='审核人')
        class Meta:
            model = ClsbbtbkCheck
            fields = ['id', 'clsbbtbk','check_user','check_user_name','opinion','is_agree','add_time']

    clsbb_checks_items = ClsbbtbkChecksSerializer(
        source='check_records', many=True, read_only=True, label='审核记录')


    class Downloads_logSerializer(BaseSerializer):
        download_by_name = CharField(source='download_by.name', read_only=True, label='下载人')
        download_by_company = CharField(source='download_by.company.name', read_only=True, label='下载所属公司')
        class Meta:
            model = Tbk_Downloads_log
            fields = "__all__"


    class Views_logSerializer(BaseSerializer):
        view_by_name = CharField(source='view_by.name', read_only=True, label='查看人')
        view_by_company = CharField(source='view_by.company.name', read_only=True, label='查看人所属公司')
        class Meta:
            model = Tbk_Views_log
            fields = "__all__"

    downloads_logs = Downloads_logSerializer(source='downloads_log', read_only=True,many=True,label='下载记录')
    views_logs = Views_logSerializer(source='views_log', read_only=True, many=True, label='查看记录')

    class Meta:
        model = Clsbbtbk_Records
        # read_only_fields = ['id','clsbbfak_pdf_item','clsbbfak_checks_items','downloads_logs_items','views_logs_items','downloads', 'views']
        read_only_fields = ['id', 'company_name',
                  'product_name',
                  'industry_name',
                  'template_type_name',
                  'attachments_data_item',

                'clsbb_checks_items','downloads', 'views','downloads_logs','views_logs']
        fields = ['company',
                  'number','keywords','name',
                  'describe',
                  'contact',
                  'contact_phone',
                  'contact_email',
                  'maintainer',
                  'maintainer_phone',
                  'maintainer_email',
                  'remarks',
                  'template_type',
                  'industry',
                  'product',
                  'attachments_data',
                  'filled_by',
                  'filled_by_name',
                  'step','next_checker',
                  'next_checker_name',
                  'is_effective','add_time',
                  *read_only_fields]


    def create(self, validated_data):
        return super().create(validated_data)

    def update(self, instance, validated_data):
        return super().update(instance, validated_data)



class Clsbbcpk_RecordsSerializer(BaseSerializer):
    company_name = CharField(source='company.name',  read_only=True, label='公司')
    filled_by_name = CharField(source='filled_by.name',  read_only=True, label='填报人')
    next_checker_name = CharField(source='next_checker.name',  read_only=True, label='下一步审核人')

    class Clsbb_Common_PdfsSerializer(BaseSerializer):
        class Meta:
            model = Clsbb_Common_Pdfs
            fields = ['id', 'file','name','type']

    attachments_plan_item = Clsbb_Common_PdfsSerializer(source='attachments_plan', read_only=True, label='产品方案')
    attachments_other_item = Clsbb_Common_PdfsSerializer(source='attachments_other', read_only=True, label='其它附件')
    class ClsbbcpkChecksSerializer(BaseSerializer):
        check_user_name = CharField(source='check_user.name', read_only=True, label='审核人')
        class Meta:
            model = ClsbbcpkCheck
            fields = ['id', 'clsbbcpk','check_user','check_user_name','opinion','is_agree','add_time']

    clsbb_checks_items = ClsbbcpkChecksSerializer(
        source='check_records', many=True, read_only=True, label='审核记录')

    class Downloads_logSerializer(BaseSerializer):
        download_by_name = CharField(source='download_by.name', read_only=True, label='下载人')
        download_by_company = CharField(source='download_by.company.name', read_only=True, label='下载所属公司')
        class Meta:
            model = Cpk_Downloads_log
            fields = "__all__"


    class Views_logSerializer(BaseSerializer):
        view_by_name = CharField(source='view_by.name', read_only=True, label='查看人')
        view_by_company = CharField(source='view_by.company.name', read_only=True, label='查看人所属公司')
        class Meta:
            model = Cpk_Views_log
            fields = "__all__"

    downloads_logs = Downloads_logSerializer(source='downloads_log', read_only=True,many=True,label='下载记录')
    views_logs = Views_logSerializer(source='views_log', read_only=True, many=True, label='查看记录')

    class Meta:
        model = Clsbbcpk_Records
        # read_only_fields = ['id','clsbbfak_pdf_item','clsbbfak_checks_items','downloads_logs_items','views_logs_items','downloads', 'views']
        read_only_fields = ['id', 'company_name',
                  'attachments_plan_item',
                  'attachments_other_item',

                'clsbb_checks_items','downloads', 'views','downloads_logs','views_logs']
        fields = ['company',
                  'number','name',
                  'model',
                  'functions',
                  'cost_price',
                  'settlement_price',
                  'manufactor',
                  'delete_flag',
                  'contact',
                  'contact_phone',
                  'maintainer',
                  'maintainer_phone',
                  'remarks',
                  'attachments_plan',
                  'attachments_other',
                  'filled_by',
                  'filled_by_name',
                  'step','next_checker',
                  'next_checker_name',
                  'is_effective','add_time',
                  *read_only_fields]


    def create(self, validated_data):
        return super().create(validated_data)

    def update(self, instance, validated_data):
        return super().update(instance, validated_data)


class Clsbbhzhbk_RecordsSerializer(BaseSerializer):
    company_name = CharField(source='company.name',  read_only=True, label='公司')
    filled_by_name = CharField(source='filled_by.name',  read_only=True, label='填报人')
    next_checker_name = CharField(source='next_checker.name',  read_only=True, label='下一步审核人')

    class Clsbb_Common_PdfsSerializer(BaseSerializer):
        class Meta:
            model = Clsbb_Common_Pdfs
            fields = ['id', 'file','name','type']

    attachments_qualification_item = Clsbb_Common_PdfsSerializer(source='attachments_qualification', read_only=True, label='产品方案')
    class ClsbbhzhbkChecksSerializer(BaseSerializer):
        check_user_name = CharField(source='check_user.name', read_only=True, label='审核人')
        class Meta:
            model = ClsbbhzhbkCheck
            fields = ['id', 'clsbbhzhbk','check_user','check_user_name','opinion','is_agree','add_time']

    clsbb_checks_items = ClsbbhzhbkChecksSerializer(
        source='check_records', many=True, read_only=True, label='审核记录')


    class Downloads_logSerializer(BaseSerializer):
        download_by_name = CharField(source='download_by.name', read_only=True, label='下载人')
        download_by_company = CharField(source='download_by.company.name', read_only=True, label='下载所属公司')
        class Meta:
            model = Hzhbk_Downloads_log
            fields = "__all__"


    class Views_logSerializer(BaseSerializer):
        view_by_name = CharField(source='view_by.name', read_only=True, label='查看人')
        view_by_company = CharField(source='view_by.company.name', read_only=True, label='查看人所属公司')
        class Meta:
            model = Hzhbk_Views_log
            fields = "__all__"

    downloads_logs = Downloads_logSerializer(source='downloads_log', read_only=True,many=True,label='下载记录')
    views_logs = Views_logSerializer(source='views_log', read_only=True, many=True, label='查看记录')

    class Meta:
        model = Clsbbhzhbk_Records
        # read_only_fields = ['id','clsbbfak_pdf_item','clsbbfak_checks_items','downloads_logs_items','views_logs_items','downloads', 'views']
        read_only_fields = ['id', 'company_name',
                  'attachments_qualification_item',
                'clsbb_checks_items','downloads', 'views','downloads_logs','views_logs']
        fields = ['company',
                  'number','name',
                  'describe',
                  'business_scope',
                  'business_qualification',
                  'agreement_is_signed',
                  'framework_agreement_is_signed',
                  'channel_purchased_is_needs',
                  'Introduction_method',
                  'contact',
                  'contact_phone',
                  'maintainer',
                  'maintainer_phone',
                  'attachments_qualification',
                  'remarks',
                  'filled_by',
                  'filled_by_name',
                  'step','next_checker',
                  'next_checker_name',
                  'is_effective','add_time',
                  *read_only_fields]


    def create(self, validated_data):
        return super().create(validated_data)

    def update(self, instance, validated_data):
        return super().update(instance, validated_data)


class Clsbbgszzk_RecordsSerializer(BaseSerializer):
    company_name = CharField(source='company.name',  read_only=True, label='公司')
    filled_by_name = CharField(source='filled_by.name',  read_only=True, label='填报人')
    next_checker_name = CharField(source='next_checker.name',  read_only=True, label='下一步审核人')

    class Clsbb_Common_PdfsSerializer(BaseSerializer):
        class Meta:
            model = Clsbb_Common_Pdfs
            fields = ['id', 'file','name','type']

    attachments_company_qualification_item = Clsbb_Common_PdfsSerializer(source='attachments_company_qualification', read_only=True, label='公司资质附件')
    class ClsbbgszzkChecksSerializer(BaseSerializer):
        check_user_name = CharField(source='check_user.name', read_only=True, label='审核人')
        class Meta:
            model = ClsbbgszzkCheck
            fields = ['id', 'clsbbgszzk','check_user','check_user_name','opinion','is_agree','add_time']

    clsbb_checks_items = ClsbbgszzkChecksSerializer(
        source='check_records', many=True, read_only=True, label='审核记录')


    class Downloads_logSerializer(BaseSerializer):
        download_by_name = CharField(source='download_by.name', read_only=True, label='下载人')
        download_by_company = CharField(source='download_by.company.name', read_only=True, label='下载所属公司')
        class Meta:
            model = Gszzk_Downloads_log
            fields = "__all__"


    class Views_logSerializer(BaseSerializer):
        view_by_name = CharField(source='view_by.name', read_only=True, label='查看人')
        view_by_company = CharField(source='view_by.company.name', read_only=True, label='查看人所属公司')
        class Meta:
            model = Gszzk_Views_log
            fields = "__all__"

    downloads_logs = Downloads_logSerializer(source='downloads_log', read_only=True,many=True,label='下载记录')
    views_logs = Views_logSerializer(source='views_log', read_only=True, many=True, label='查看记录')

    class Meta:
        model = Clsbbgszzk_Records
        # read_only_fields = ['id','clsbbfak_pdf_item','clsbbfak_checks_items','downloads_logs_items','views_logs_items','downloads', 'views']
        read_only_fields = ['id', 'company_name',
                  'attachments_company_qualification_item',
                'clsbb_checks_items','downloads', 'views','downloads_logs','views_logs']
        fields = ['company',
                  'number','name',
                  'issued_by',
                  'issuing_date',
                  'expiration_date',
                  'renewal_date',
                  'qualification_status',
                  'qualification_classification',
                  'qualification_grade',
                  'contact',
                  'contact_phone',
                  'maintainer',
                  'maintainer_phone',
                  'attachments_company_qualification',
                  'remarks',
                  'filled_by',
                  'filled_by_name',
                  'step','next_checker',
                  'next_checker_name',
                  'is_effective','add_time',
                  *read_only_fields]


    def create(self, validated_data):
        return super().create(validated_data)

    def update(self, instance, validated_data):
        return super().update(instance, validated_data)



class Clsbbryzzk_RecordsSerializer(BaseSerializer):
    company_name = CharField(source='company.name',  read_only=True, label='公司')
    filled_by_name = CharField(source='filled_by.name',  read_only=True, label='填报人')
    next_checker_name = CharField(source='next_checker.name',  read_only=True, label='下一步审核人')

    class Clsbb_Common_PdfsSerializer(BaseSerializer):
        class Meta:
            model = Clsbb_Common_Pdfs
            fields = ['id', 'file','name','type']

    attachments_personnel_qualification_item = Clsbb_Common_PdfsSerializer(source='attachments_personnel_qualification', read_only=True, label='人员资质附件')
    class ClsbbryzzkChecksSerializer(BaseSerializer):
        check_user_name = CharField(source='check_user.name', read_only=True, label='审核人')
        class Meta:
            model = ClsbbryzzkCheck
            fields = ['id', 'clsbbryzzk','check_user','check_user_name','opinion','is_agree','add_time']

    clsbb_checks_items = ClsbbryzzkChecksSerializer(
        source='check_records', many=True, read_only=True, label='审核记录')



    class Downloads_logSerializer(BaseSerializer):
        download_by_name = CharField(source='download_by.name', read_only=True, label='下载人')
        download_by_company = CharField(source='download_by.company.name', read_only=True, label='下载所属公司')
        class Meta:
            model = Ryzzk_Downloads_log
            fields = "__all__"


    class Views_logSerializer(BaseSerializer):
        view_by_name = CharField(source='view_by.name', read_only=True, label='查看人')
        view_by_company = CharField(source='view_by.company.name', read_only=True, label='查看人所属公司')
        class Meta:
            model = Ryzzk_Views_log
            fields = "__all__"

    downloads_logs = Downloads_logSerializer(source='downloads_log', read_only=True,many=True,label='下载记录')
    views_logs = Views_logSerializer(source='views_log', read_only=True, many=True, label='查看记录')

    class Meta:
        model = Clsbbryzzk_Records
        # read_only_fields = ['id','clsbbfak_pdf_item','clsbbfak_checks_items','downloads_logs_items','views_logs_items','downloads', 'views']
        read_only_fields = ['id', 'company_name',
                  'attachments_personnel_qualification_item',
                'clsbb_checks_items','downloads', 'views','downloads_logs','views_logs']
        fields = ['company',
                  'number','name',
                  'full_name',
                  'certification_discipline',
                  'certificate_number',
                  'issued_by',
                  'issuing_date',
                  'expiration_date',
                  'renewal_date',
                  'qualification_status',
                  'maintainer',
                  'maintainer_phone',
                  'professional_qualification_level',
                  'attachments_personnel_qualification',
                  'remarks',
                  'filled_by',
                  'filled_by_name',
                  'step','next_checker',
                  'next_checker_name',
                  'is_effective','add_time',
                  *read_only_fields]


    def create(self, validated_data):
        return super().create(validated_data)

    def update(self, instance, validated_data):
        return super().update(instance, validated_data)


class Clsbb_Common_PdfsSerializer(BaseSerializer):
    company_name = CharField(source='company.name', read_only=True, label='公司')
    filled_by_name = CharField(source='filled_by.name',  read_only=True, label='填报人')
    class Meta:
        model = Clsbb_Common_Pdfs
        read_only_fields = ['id', 'company','company_name','name','type',
                            'filled_by','filled_by_name','add_time']
        fields = ['file', *read_only_fields]

    def create(self, validated_data):
        validated_data['name'] = validated_data['file'].name
        validated_data['company'] = self.user.company
        validated_data['type'] = self.request.data['type']
        validated_data['filled_by'] = self.user
        return super().create(validated_data)



# __all__ = [
#     'Clsbbfak_RecordsSerializer',
#     'Clsbbfak_Common_PdfsSerializer',
# ]